<template>
	<view >
		<!-- #ifdef APP-PLUS -->
		<view class="title">	
		</view>
			<!-- #endif -->
		<view class="head">
			<image src="../../static/images/arrow_left.png" mode="" @click="$back()"></image>
			<view class="">金融</view>
			<view class="f32" @click="add">提交</view>
		</view>

		<view class="wen">
			App提供的金融服务为无抵押无担保的信用授信服务,使用本产品的店铺的经营数据将作为重要的授信依据。如有需要,请提交以下信息进行申请,客服人员将会即时联系您！
		</view>
		<view class="heads" style="margin-top: 0;">
			<view class="box-l">姓名</view>
			<view class="box-r">
				<input type="text" v-model="name" placeholder="" />
				<image src="../../static/images/arrow_right.png" mode=""></image>
			</view>
		</view>
		<view class="heads">
			<view class="box-l">电话</view>
			<view class="box-r">
				<input type="text" v-model="phone" placeholder="" />
				<image src="../../static/images/arrow_right.png" mode=""></image>
			</view>
		</view>
		<view class="heads">
			<view class="box-l">性别</view>
			<view class="box-r">
				<view class="bx">
					<picker @change="bindPickerChange" :value="index" :range="array">
						<view class="uni-input">{{ array[index] }}</view>
					</picker>
				</view>
				<image src="../../static/images/arrow_right.png" mode=""></image>
			</view>
		</view>
		<view class="heads">
			<view class="box-l">身份</view>
			<view class="box-r">
				<view class="bx">
					<picker @change="bindPickerCh" v-model="index" :range="arr">
						<view class="uni-input">{{ arr[cmd] }}</view>
					</picker>
				</view>
				<image src="../../static/images/arrow_right.png" mode=""></image>
			</view>
		</view>
		<view class="heads">
			<view class="box-l">授信用途</view>
			<view class="box-r"><input type="text" v-model="yong" placeholder="必填" /></view>
		</view>
	</view>
</template>

<script>

export default {
	data() {
		return {
			array: ['男', '女'],
			arr: ['企业老板', '企业管理人员', '个体工商户', '普通上班族', '其他'],
			index: 0,
			cmd: 0,
			name: '',
			phone: '',
			yong: '',
			phonetwo:''
		};
	},
	onLoad() {
		this.showUser()
	},
	methods: {
		bindPickerChange: function(e) {
			console.log('picker发送选择改变，携带值为', e.target.value);
			this.index = e.target.value;
		},
		bindPickerCh: function(e) {
			console.log('picker发送选择改变，携带值为', e.target.value);
			this.cmd = e.target.value;
		},
	
		add() {
			if (this.yong === '') {
				uni.showToast({
					title: '授信用途不可为空',
					duration: 2000,
					icon: 'none'
				});
				return
			}
			this.$ajax('api/v1.loan/ask', {
				telephone: this.phone,
				name: this.name,
				purpose: this.yong,
				gender: this.index,
				identity: this.arr[this.cmd]
			})
				.then(res => {
					// console.log(res);
					uni.showToast({
						title:'您以提交成功,客服将尽快与您联系',
						icon:'none'
					})
				})
				.catch(res => {
					console.log(Error);
				});
		},
		showUser(){
	
			   this.$ajax(
			    '/api/v1.shop/index',
			    {

			    },
			    'GET'
			   ).then(res => {
			this.name=res.result.user_info.name;
			this.phone=res.result.user_info.telephone
			   });
			  
		}
	}
};
</script>

<style lang="scss">
page {
	background-color: #f7f4f8;

}

.title {
	height:58rpx;
}
.head {
	height: 90rpx;
	line-height: 88rpx;
	background-color: #249af6;
	color: #ffffff;
	display: flex;
	justify-content: space-between;
	padding: 0 30rpx;
	font-size: 36rpx;
	font-family: PingFang SC;
	font-weight: 500;
	image {
		width: 22rpx;
		height: 39rpx;
		margin-top: 25rpx;
	}
}
.wen {
	line-height: 42rpx;
	font-size: 28rpx;
	font-family: PingFang SC;
	font-weight: 500;
	color: rgba(102, 102, 102, 1);
	padding: 30rpx;
	box-sizing: border-box;
}
.heads {
	height: 110rpx;
	line-height: 110rpx;
	background-color: #ffffff;
	margin-top: 30rpx;
	display: flex;
	justify-content: space-between;
	padding: 0 30rpx;
	font-size: 32rpx;
	font-family: PingFang SC;
	font-weight: 500;
	position: relative;
	image {
		width: 18rpx;
		height: 33rpx;
		vertical-align: middle;
		margin-left: 20rpx;
	}
	.box-r {
		.box-l {
			position: absolute;
			left: 0;
		}
		input {
			width: 100%;
			text-align: right;
			height: 100%;
			overflow: hidden;
			padding-left: 100rpx;
			box-sizing: border-box;
		}
		.bx {
			position: absolute;
			right: 100rpx;
		}
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: rgba(102, 102, 102, 1);
	}
}
</style>
